<template>
  <div class="edu-page-warp">
    <div class="edu-page-title">{{ $t('message.filterCondition') }}</div>
    <el-card shadow="never" body-style="padding: 24px;">
      <el-form ref="queryForm" :model="queryForm" label-width="80px" class="bg-white pd-12px">
        <el-row :gutter="20" style="height: 50px;">
          <el-col :span="6">
            <el-form-item label="年级:" :label-width="formLabelWidth" prop="grade">
              <el-select v-model="queryForm.grade">
                <el-option
                  v-for="item in options.grade"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="学院:" :label-width="formLabelWidth" prop="faculty">
              <el-select v-model="queryForm.faculty" filterable @change="changeFaculty">
                <el-option
                  v-for="item in options.faculty"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="专业:" :label-width="formLabelWidth" prop="profession">
              <el-select v-model="queryForm.profession" filterable>
                <el-option
                  v-for="item in options.profession"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="培养层次:" :label-width="formLabelWidth" prop="trainingLevel">
              <el-select v-model="queryForm.trainingLevel">
                <el-option
                  v-for="item in options.trainingLevel"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20" style="height: 50px;">
          <el-col :span="6">
            <el-form-item label="培养类别:" :label-width="formLabelWidth">
              <el-select v-model="queryForm.studentCategory">
                <el-option
                  v-for="item in options.studentCategory"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <!-- <el-col :span="6">
            <el-form-item label="是否获得毕业证:" :label-width="formLabelWidth">
              <el-select v-model="queryForm" filterable>
                <el-option>是</el-option>
                <el-option>否</el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="是否获得学位证:" :label-width="formLabelWidth">
              <el-select v-model="queryForm" filterable>
                <el-option>是</el-option>
                <el-option>否</el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="培养完成情况:" :label-width="formLabelWidth">
              <el-select v-model="queryForm" filterable>
                <el-option>是</el-option>
                <el-option>否</el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row> 
          <el-row :gutter="20" style="height: 50px;">-->
          <el-col :span="6">
            <el-form-item label="在校标识:" :label-width="formLabelWidth">
              <el-select v-model="queryForm.leaveSchool">
                <el-option label="离校" value="1"></el-option>
                <el-option label="在校" value="0"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <!-- <el-col :span="6">
            <el-form-item label="在校标识:" :label-width="formLabelWidth" prop="keyWord">
              <el-input style="width: 187px;" v-model="queryForm.keyWord" placeholder/>
            </el-form-item>
          </el-col>-->
          <el-col :span="6">
            <div class="empty-box" />
          </el-col>
          <el-col :span="6">
            <el-form-item class="float-right">
              <el-button @click="reset">{{ $t('message.reset') }}</el-button>
              <el-button type="primary" @click="onSubmit">{{ $t('message.filter') }}</el-button>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </el-card>
    <div class="edu-page-title mg-top">{{ $t('message.leaveStudentList') }}</div>
    <el-card shadow="never" body-style="padding: 24px;">
      <el-row class="border-bottom" style="height:56px;">
        <el-col :span="4">
          <el-input
            v-model="queryForm.keyWord"
            placeholder="学号或姓名搜索"
            prefix-icon="el-icon-search"
            @keyup.enter.native="onSubmit"
          />
        </el-col>
        <el-col :span="8">
          <div class="empty-box" />
        </el-col>
        <el-col :span="12">
          <div class="float-right">
            <el-button plain @click="downloadTemplate()">导入模板下载</el-button>
            <el-button plain @click="batchImport()">批量导入处理</el-button>
            <el-button plain @click="exportFile()">{{ $t('message.export') }}</el-button>
            <el-button type="primary" @click="leaveSchool()">离校处理</el-button>
          </div>
        </el-col>
      </el-row>
      <el-table :data="students" size="mini" @selection-change="handlerSelectionChange">
        <el-table-column type="selection" width="55" stripe />
        <el-table-column prop="studentId" label="学号" width="80" />
        <el-table-column label="姓名" width="100">
          <template slot-scope="scope">{{ scope.row.name }}</template>
        </el-table-column>
        <el-table-column label="年级" width="100">
          <template slot-scope="scope">{{ scope.row.grade }}</template>
        </el-table-column>
        <el-table-column label="学院">
          <template slot-scope="scope">{{ scope.row.facultyI18n}}</template>
        </el-table-column>
        <el-table-column label="专业">
          <template slot-scope="scope">{{ scope.row.professionI18n }}</template>
        </el-table-column>
        <el-table-column label="培养层次">
          <template slot-scope="scope">{{ scope.row.trainingLevelI18n }}</template>
        </el-table-column>
        <el-table-column label="培养类别">
          <template slot-scope="scope">{{ scope.row.studentCategoryI18n }}</template>
        </el-table-column>
        <!-- <el-table-column label="是否获取毕业证">
          <template slot-scope="scope">{{ scope.row.trainingLevel }}</template>
        </el-table-column>
        <el-table-column label="是否获取学位证">
          <template slot-scope="scope">{{ scope.row.trainingLevel }}</template>
        </el-table-column>-->
        <!-- <el-table-column label="是否国际学生">
          <template slot-scope="scope">{{ scope.row.studentCategory }}</template>
        </el-table-column>-->
        <el-table-column label="是否双学位">
          <template slot-scope="scope">{{ scope.row.isDobleDegreeI18n}}</template>
        </el-table-column>
        <el-table-column label="预计毕业时间">
          <template
            slot-scope="scope"
          >{{ scope.row.expectedGraduationDate | formatDate('yyyy-MM-dd') }}</template>
        </el-table-column>
        <!-- <el-table-column label="培养完成情况">
          <template slot-scope="scope">{{ scope.row.trainingLevel }}</template>
        </el-table-column>-->
        <el-table-column label="在校标识">
          <template slot-scope="scope">{{ scope.row.leaveSchoolI18n }}</template>
        </el-table-column>
        <el-table-column label="离校时间">
          <template slot-scope="scope">{{ scope.row.leaveTime | formatDate('yyyy-MM-dd') }}</template>
        </el-table-column>
        <el-table-column label="操作" width="90">
          <template slot-scope="scope">
            <el-button
              v-if="scope.row.leaveSchool == '1'"
              type="text"
              size="mini"
              @click="revert(scope.row)"
            >撤销</el-button>
            <el-button v-else type="text" size="mini" @click="singleLeaveSchool(scope.row)">离校</el-button>

            <el-button type="text" size="mini" @click="viewDetail(scope.row.studentId)">查看</el-button>
            <!-- <el-button type="text" @click="editTask(scope.row)" size="mini">编辑</el-button> -->
          </template>
        </el-table-column>
      </el-table>

      <div class="edu-pagination">
        <div class="float-right">
          <el-pagination
            :current-page="queryForm.pageNum_"
            :page-sizes="[20,50,100,500,1000]"
            :page-size="queryForm.pageSize_"
            :total="totalCount"
            layout="total, sizes, prev, pager, next, jumper"
            style="float: right;margin:10px 60px 0 0;"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
          />
        </div>
      </div>
    </el-card>
    <!--批量离校处理弹窗-->
    <el-dialog
      :title.sync="dialogConfig.dialogTitle"
      :visible.sync="dialogConfig.showDialog"
      width="40%"
      :before-close="handleDialogClose"
    >
      <el-form :model="dialogConfig.formData" :inline="true" :rules="dialogConfig.rules">
        <el-form-item label="离校原因：" prop="leaveReason">
          <el-input
            style="width: 450px;height: 70px;"
            v-model="dialogConfig.formData.leaveReason"
            type="textarea"
          ></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogConfig.showDialog = false">取 消</el-button>
        <el-button type="primary" @click="handlerBatchLeaveSchool">确 定</el-button>
      </span>
    </el-dialog>
    <!--撤销弹框-->
    <el-dialog
      :title.sync="revertDialog.dialogTitle"
      :visible.sync="revertDialog.dialogVisible"
      width="30%"
    >
      <span>确定撤销？</span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="revertDialog.dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="handlerRevertStudent">确 定</el-button>
      </span>
    </el-dialog>
    <!--单个离校弹框-->
    <el-dialog
      :title.sync="leaveSchoolDialog.dialogTitle"
      :visible.sync="leaveSchoolDialog.showDialog"
      width="40%"
    >
      <el-form :inline="true">
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="学号:" :label-width="leaveSchoolDialog.labelWidth">
              <el-input v-model="leaveSchoolDialog.data.studentId" :disabled="true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="姓名:" :label-width="leaveSchoolDialog.labelWidth">
              <el-input v-model="leaveSchoolDialog.data.name" :disabled="true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="年级:" :label-width="leaveSchoolDialog.labelWidth" prop="studentId">
              <el-input v-model="leaveSchoolDialog.data.grade" :disabled="true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="导师:" :label-width="leaveSchoolDialog.labelWidth">
              <el-input v-model="leaveSchoolDialog.data.teacherName" :disabled="true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item
              label="培养层次:"
              :label-width="leaveSchoolDialog.labelWidth"
              prop="studentId"
            >
              <el-input v-model="leaveSchoolDialog.data.trainingLevelI18n" :disabled="true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="培养类别:" :label-width="leaveSchoolDialog.labelWidth">
              <el-input v-model="leaveSchoolDialog.data.studentCategory" :disabled="true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="学院:" :label-width="leaveSchoolDialog.labelWidth">
              <el-input v-model="leaveSchoolDialog.data.facultyI18n" :disabled="true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="专业:" :label-width="leaveSchoolDialog.labelWidth">
              <el-input v-model="leaveSchoolDialog.data.professionI18n" :disabled="true" />
            </el-form-item>
          </el-col>
        </el-row>
        <!-- <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item
              label="是否获取毕业证:"
              :label-width="leaveSchoolDialog.labelWidth"
              prop="studentId"
            >
              <el-input v-model="leaveSchoolDialog.data.studentId" :disabled="true"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="毕业证书发放时间:" :label-width="leaveSchoolDialog.labelWidth">
              <el-input v-model="leaveSchoolDialog.data.name" :disabled="true"/>
            </el-form-item>
          </el-col>
        </el-row>-->
        <!-- <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item
              label="是否获取学位证:"
              :label-width="leaveSchoolDialog.labelWidth"
              prop="studentId"
            >
              <el-input v-model="leaveSchoolDialog.data.studentId" :disabled="true"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="学位证书发放时间:" :label-width="leaveSchoolDialog.labelWidth">
              <el-input v-model="leaveSchoolDialog.data.name" :disabled="true"/>
            </el-form-item>
          </el-col>
        </el-row>-->
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="在校标识:" :label-width="leaveSchoolDialog.labelWidth">
              <el-input v-model="leaveSchoolDialog.data.leaveSchoolI18n" :disabled="true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="离校时间:" :label-width="leaveSchoolDialog.labelWidth">
              <el-input v-model="leaveSchoolDialog.data.leaveTime" :disabled="true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="操作人:" :label-width="leaveSchoolDialog.labelWidth">
              <el-input v-model="leaveSchoolDialog.data.operator" :disabled="true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="操作时间:" :label-width="leaveSchoolDialog.labelWidth">
              <el-input
                :value="leaveSchoolDialog.data.operateTime | formatDate('yyyy-MM-dd hh:mm:ss')"
                :disabled="true"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <!-- <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item
              label="操作IP地址:"
              :label-width="leaveSchoolDialog.labelWidth"
              prop="studentId"
            >
              <el-input v-model="leaveSchoolDialog.data.studentId" :disabled="true"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <div class="empty-box"></div>
          </el-col>
        </el-row>-->
        <el-row :gutter="20">
          <el-col :span="24">
            <el-form-item label="原因：" :label-width="leaveSchoolDialog.labelWidth">
              <el-input
                style="width: calc(200% - 100px);"
                v-model="leaveSchoolDialog.leaveReason"
                placeholder="请输入"
                type="textarea"
              />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="leaveSchoolDialog.showDialog = false">取 消</el-button>
        <el-button type="primary" @click="handlerSingleLeaveSchool">确 定</el-button>
      </span>
    </el-dialog>
    <!--批量导入弹窗-->
    <el-dialog
      :title.sync="batchImportDialog.dialogTitle"
      :visible.sync="batchImportDialog.showDialog"
      width="30%"
    >
      <el-upload
        action="/api/studentservice/studentdeparture/importDepartureList"
        ref="upload"
        :file-list="batchImportDialog.uploadConfig.fileList"
        :on-success="handlerSuccess"
        :on-error="handlerError"
        :on-change="batchImportDialog.uploadConfig.handlerChange"
        :on-exceed="batchImportDialog.uploadConfig.handlerExceed"
        accept="xlsx"
        :auto-upload="false"
      >
        <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
        <el-button style="margin-left: 10px;" size="small" type="success" @click="uploadFile">上传</el-button>
      </el-upload>
      <span slot="footer" class="dialog-footer">
        <el-button @click="batchImportDialog.showDialog = false">关闭</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import * as API from "common/src/api/leaveStudents";
import { queryDic } from "common/src/api/dictionary";
import utils from "common/src/utils/utils";
export default {
  name: "LeaveStudentList",
  data() {
    const getGrade = (function() {
      const now = new Date().getFullYear();
      const years = [];
      for (let i = 0; i < 6; i++) {
        years.push({
          label: now - i,
          value: now - i
        });
      }
      return years;
    })();
    return {
      loading: false,
      formLabelWidth: "100px",
      queryForm: {
        grade: "",
        trainingLevel: "",
        studentCategory: "",
        faculty: "",
        profession: "",
        leaveSchool: "",
        keyWord: "",
        pageNum_: 1,
        pageSize_: 20
      },
      options: {
        trainingLevel: [],
        grade: getGrade,
        faculty: [],
        profession: [],
        studentCategory: []
      },
      students: [],
      totalCount: 0,
      selectedItems: [],
      dialogConfig: {
        dialogTitle: "提示",
        showDialog: false,
        tipText: "",
        formData: {
          leaveReason: ""
        },
        params: {},
        rules: {
          leaveReason: [
            {
              required: true,
              message: "输入不能为空",
              trigger: "blur"
            }
          ]
        }
      },
      batchImportDialog: {
        dialogTitle: "批量上传",
        showDialog: false,
        uploadConfig: {
          fileList: [],

          handlerChange(file, fileList) {
            this.fileList = fileList.slice(-1);
          },
          handlerExceed(file, fileList) {
            this.fileList = fileList.slice(-1);
          }
        }
      },
      leaveSchoolDialog: {
        dialogTitle: "学生离校",
        showDialog: false,
        labelWidth: "100px",
        data: {},
        leaveReason: ""
      },
      revertDialog: {
        dialogTitle: "撤销",
        dialogVisible: false,
        data: {}
      }
    };
  },
  mounted() {
    this.initOptions();
  },
  methods: {
    initOptions() {
      const data = {
        lang: this.$store.getters.language || "cn",
        type: "allChild",
        keys: ["X_PYCC", "X_YX", "X_PYLB"]
      };
      queryDic(data).then(res => {
        if (res.code === 200) {
          this.fillSelect(res.data);
          this.onSubmit();
        }
      });
    },
    changeFaculty(val) {
      this.options["profession"] = [];
      const data = {
        lang: this.$store.getters.language || "cn",
        type: "allChild",
        keys: ["G_ZY"],
        filter: {
          prefix: [val],
          specilaCode: "XY2ZY"
        }
      };
      queryDic(data).then(res => {
        if (res.code === 200) this._fill("profession", res.data.G_ZY);
      });
    },
    fillSelect(data) {
      let { X_PYCC, X_YX, X_PYLB } = data;
      this._fill("trainingLevel", X_PYCC);
      this._fill("faculty", X_YX);
      this._fill("studentCategory", X_PYLB);
      // this._fill("profession", data.G_ZY);
    },
    _fill(type, data) {
      for (const key in data) {
        this.options[type].push({
          value: key,
          label: data[key]
        });
      }
    },
    onSubmit() {
      this.loading = true;
      API.getLeaveStudentList(this.queryForm)
        .then(response => {
          if (response.code === 200) {
            this.students = response.data.list;
            this.totalCount = response.data.total_;
          } else throw response.code;
        })
        .finally(() => (this.loading = false));
    },
    revert(data) {
      this.revertDialog.data = data;
      this.revertDialog.dialogVisible = true;
    },
    handlerRevertStudent() {
      API.revertStudent({ studentId: this.revertDialog.data.studentId })
        .then(
          response => {
            if (response.code === 200) {
              this.$message({
                message: "撤销成功",
                type: "success"
              });
            }
            this.onSubmit();
          },
          xhr => {}
        )
        .finally(() => {
          this.revertDialog.dialogVisible = false;
        });
    },
    handleCurrentChange(val) {
      this.queryForm.pageNum_ = val;
      this.onSubmit();
    },
    handleSizeChange(val) {
      this.queryForm.pageSize_ = val;
      this.onSubmit();
    },
    viewDetail(_studentId) {
      this.$router.push({
        name: "leaveStudentDetail",
        params: {
          studentId: _studentId
        }
      });
    },
    reset() {
      this.queryForm.trainingLevel = "";
      this.queryForm.grade = "";
      this.queryForm.faculty = "";
      this.queryForm.profession = "";
      this.queryForm.studentCategory = "";
      this.queryForm.leaveSchool = "";
      this.queryForm.keyWord = "";
      this.queryForm.pageNum_ = 1;
      this.queryForm.pageSize_ = 20;
      this.onSubmit();
    },
    downloadTemplate() {
      let columns = [["学号", "姓名", "处理原因"]];
      utils.exportAsXlsx(columns, "离校学生名单导入模板.xlsx");
    },
    batchImport() {
      this.batchImportDialog.showDialog = true;
    },
    handlerSuccess(response, file, fileList) {
      let responseCode = response.code;
      if (responseCode === 200) {
        this.$message({
          message: "导入成功！",
          type: "success"
        });
      } else {
        this.$message({
          message: "文件列名错误或文件为空！",
          type: "error"
        });
      }
      this.onSubmit();
      this.$refs.upload.clearFiles();
      this.batchImportDialog.showDialog = false;
    },
    handlerError(rresponse, file, fileList) {
      this.$message({
        message: "上传失败！",
        type: "error"
      });
      this.$refs.upload.clearFiles();
      this.batchImportDialog.showDialog = false;
    },
    uploadFile() {
      let file = this.$refs.upload.fileList[0];
      if (!file) {
        this.$message({
          type: "error",
          message: "没选择任何文件！"
        });
        return;
      }
      if (!/.+\.xlsx$/.test(file.name)) {
        this.$message({
          type: "error",
          message: "请选择xlsx结尾的文件！"
        });
        return;
      }
      this.$refs.upload.submit();
    },
    exportFile() {
      let params = utils.clone(this.queryForm);
      params.hasOwnProperty("pageNum_") && delete params.pageNum_;
      params.hasOwnProperty("pageSize_") && delete params.pageSize_;
      if (!this.isAllKeyEmpty(params)) {
        return this.$message({
          type: "error",
          message: "请选择至少一个条件导出数据！"
        });
      }
      API.exportLeaveStudentList(params);
    },
    singleLeaveSchool(item) {
      this.leaveSchoolDialog.leaveReason = "";
      this.leaveSchoolDialog.data = item;
      this.leaveSchoolDialog.data.operator =
        localStorage.getItem("userName") || "";
      this.leaveSchoolDialog.data.operateTime = Date.parse(new Date());

      this.leaveSchoolDialog.showDialog = true;
    },
    handlerSingleLeaveSchool() {
      API.batchLeaveSchool({
        ids: [this.leaveSchoolDialog.data.studentId],
        leaveReason: this.leaveSchoolDialog.leaveReason
      })
        .then(
          response => {
            if (response.code == 200) {
              this.$message({
                message: "离校成功！",
                type: "success"
              });
              this.onSubmit();
            }
          },
          xhr => {}
        )
        .finally(() => {
          this.leaveSchoolDialog.showDialog = false;
        });
    },
    leaveSchool() {
      this.dialogConfig.formData.leaveReason = "";
      let { selectedItems } = this;
      if (selectedItems.length === 0) {
        let params = utils.clone(this.queryForm);
        params.hasOwnProperty("pageNum_") && delete params.pageNum_;
        params.hasOwnProperty("pageSize_") && delete params.pageSize_;
        if (!this.isAllKeyEmpty(params)) {
          return this.$message({
            type: "error",
            message: "请选择至少一个条件！"
          });
        }
        // 发送给后台的参数是查询条件
        this.dialogConfig.showDialog = true;
        this.dialogConfig.params = this.queryForm;
      } else {
        //判断是否都可以离校
        let data = selectedItems.filter(item => item.leaveSchool != "1");
        // 选中的学生都已经离校，不能进行离校处理，弹框提示
        if (data.length === 0) {
          this.$message({
            type: "error",
            message: "选中的学生都已经离校，不能进行离校操作!"
          });
        } else {
          this.dialogConfig.params = {};
          this.dialogConfig.params.ids = data.map(item => item.id);
          this.dialogConfig.showDialog = true;
        }
      }
    },

    handlerSelectionChange(val) {
      this.selectedItems = val;
    },
    handlerBatchLeaveSchool() {
      let params = {
        leaveReason: this.dialogConfig.formData.leaveReason,
        ...this.dialogConfig.params
      };
      //params.hasOwnProperty('keyWord') && delete params.keyWord
      params.hasOwnProperty("pageNum_") && delete params.pageNum_;
      params.hasOwnProperty("pageSize_") && delete params.pageSize_;
      API.batchLeaveSchool(params)
        .then(
          response => {
            if (response.code == 200) {
              this.$message({
                message: "离校成功",
                type: "success"
              });
              this.onSubmit();
            }
          },
          xhr => {}
        )
        .finally(() => {
          this.dialogConfig.showDialog = false;
        });
    },
    isAllKeyEmpty(obj = {}) {
      return !!Object.values(obj).join("");
    }
  }
};
</script>
<style>
</style>
